//This file contains the main function.
//It is used to instantiate chaincode and its smart contracts.
//Now the chaincode contains one smart contract: ModelContract.(See ModelContract.go)
package main

import (
	"github.com/hyperledger/fabric-contract-api-go/contractapi"
	"log"
)

func main() {
	//instantiate a ModelContract named modelContract
	modelContract:=new (ModelContract)
	modelContract.TransactionContextHandler=new(contractapi.TransactionContext)
	modelContract.UnknownTransaction = UnknownTransactionHandler
	modelContract.Name="ModelContract"

	//instantiate a chaincode named cc, and put above ModelContract modelContract into chaincode cc
	cc, err := contractapi.NewChaincode(modelContract)
	if err != nil {
		log.Fatal(err)
	}

	//set modelContract as default contract of cc
	cc.DefaultContract=modelContract.GetName()

	//start cc
	if err := cc.Start(); err != nil {
		panic(err.Error())
	}
}
